package com.xiaohu.common;

import java.io.Serializable;
import java.util.List;

/**
 * 统一返回值实体类
 */
public class ResultEntity implements Serializable {

    /**
     *成功就使用OK常量
     */
    public static final int OK = 0;

    /**
     * 失败就使用ERROR常量
     */
    public static final int ERROR = 1;

    /**
     *查询成功
     */
    public static final String QUERY_OK = "查询成功";

    /**
     * 查询失败
     */
    public static final String QUERY_ERROR = "查询失败";


    /**
     *删除成功
     */
    public static final String DELETE_OK = "删除成功";

    /**
     * 删除失败
     */
    public static final String DELETE_ERROR = "删除失败";

    /**
     *更新成功
     */
    public static final String UPDATE_OK = "更新成功";

    /**
     * 更新失败
     */
    public static final String UPDATE_ERROR = "更新失败";


    /**
     *插入成功
     */
    public static final String INSERT_OK = "插入成功";

    /**
     * 插入失败
     */
    public static final String  INSERT_ERROR = "插入失败";

    /**
     * 返回码，返回0为成功
     */
    private int code;

    /**
     * 提示凡的信息
     */
    private String  msg;

    /**
     * 返回的总条数
     */
    private int count;

    /**
     * 返回的真实数据
     */
    private Object data;


    public int getCode() {
        return code;
    }

    public void setCode(int code) {
        this.code = code;
    }

    public String getMsg() {
        return msg;
    }

    public void setMsg(String msg) {
        this.msg = msg;
    }

    public int getCount() {
        return count;
    }

    public void setCount(int count) {
        this.count = count;
    }

    public Object getData() {
        return data;
    }

    public void setData(Object data) {
        this.data = data;
    }

    public ResultEntity() {
    }

    public ResultEntity(int code, String msg) {
        this.code = code;
        this.msg = msg;
    }

    public ResultEntity(int code, String msg, int count, Object data) {
        this.code = code;
        this.msg = msg;
        this.count = count;
        this.data = data;
    }

    @Override
    public String toString() {
        return "ResultEntity{" +
                "code=" + code +
                ", msg='" + msg + '\'' +
                ", count=" + count +
                ", data=" + data +
                '}';
    }
}
